package Day06;

import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        //6)数组的复制
       /* int[] a ={10,20,30,40,50};
        int[] b =new int [6];//0,0,0,0,0,0
        System.arraycopy(a,1,b,0,4);
        //a:源数组
        //1：源数组的起始下标
        //b:目标数组的起始下标
        //0：目标数组的起始下标
        //4：要复制的元素个数
        System.out.println(Arrays.toString(b));*/

        int[] a ={10,20,30,40,50};
        int[] b = Arrays.copyOf(a,6);//扩容
        //a:源数组
        //newLength:目标数组的长度
        System.out.println(Arrays.toString(b));



    }


}
